﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Domain.Core.Specification;
using Domain.Entities;

namespace Domain.Service.Order
{
    /// <summary>
    /// 通过用户信息得到他的订单列表
    /// </summary>
    public class OrderFromUserSpecification : Specification<Order_Info>
    {
        int _userID = default(Int32);
        public OrderFromUserSpecification(int userID)
        {
            _userID = userID;
        }
        public override global::System.Linq.Expressions.Expression<Func<Order_Info, bool>> SatisfiedBy()
        {
            Specification<Order_Info> spec = new TrueSpecification<Order_Info>();
            if (_userID > 0)
                spec &= new DirectSpecification<Order_Info>(o => o.UserID == _userID);
            return spec.SatisfiedBy();
        }
    }
}
